package com.lzkj.baotouhousingfund.ui.activity;

import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.PersistableBundle;
import android.support.annotation.Nullable;
import android.view.View;

import com.chad.library.adapter.base.BaseViewHolder;
import com.lzkj.baotouhousingfund.R;
import com.lzkj.baotouhousingfund.base.ListActivity;
import com.lzkj.baotouhousingfund.model.bean.CenterIntroductionBean;
import com.lzkj.baotouhousingfund.presenter.FocalTopicPresenter;
import com.lzkj.baotouhousingfund.presenter.contract.FocalTopicContract;

import butterknife.BindArray;
import butterknife.OnClick;

/**
 * @author lx
 * @description 焦点话题
 * @date 2018-3-13 15:20:36
 */

public class FocalTopicActivity extends ListActivity<FocalTopicPresenter,CenterIntroductionBean>
        implements FocalTopicContract.View {

    @BindArray(R.array.focal_topic)
    String[] mFocalTopic;

    private AlertDialog.Builder mAlertDialog;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mToolbarTitle.setText("焦点话题");
        mToolbarRight.setVisibility(View.VISIBLE);
        mToolbarRight.setText("选择问题");
    }

    @Override
    public void showError(String msg) {

    }

    @Override
    protected void initInject() {
        getActivityComponent().inject(this);
    }

    @Override
    protected void initEventAndData() {

    }

    @OnClick(R.id.toolbar_right)
    public void showTypeDialog() {
        if (mAlertDialog==null){
            mAlertDialog = new AlertDialog.Builder(this, AlertDialog.THEME_HOLO_LIGHT);
        }
        mAlertDialog.setItems(R.array.focal_topic,(dialogInterface, i) -> {
            mToolbarRight.setText(mFocalTopic[i]);
        });
        mAlertDialog.create().show();
    }

    public static void start(Context context){
        Intent intent =new Intent(context,FocalTopicActivity.class);
        context.startActivity(intent);
    }

    @Override
    protected void convert(BaseViewHolder helper, CenterIntroductionBean item) {

    }

    @Override
    protected int getItemLayoutId() {
        return 0;
    }
}
